home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlb20 / lib / unlink.c < prev    next >
C/C++ Source or Header  |  1991-10-19  |  646b  |  39 lines

  1. /* unlink.c: by ERS. This routine is in the public domain */
  2.  
  3. #include <limits.h>
  4. #include <stdlib.h>
  5. #include <errno.h>
  6. #include <osbind.h>
  7. #include <fcntl.h>
  8. #include "lib.h"
  9.  
  10. /* remove provided for ansi compatibility */
  11. #ifndef __GNUC__
  12. int remove(filename)
  13.     const char *filename;
  14. {
  15.     return unlink(filename);
  16. }
  17. #endif
  18.  
  19. #ifdef __GNUC__
  20. asm(".text; .even; .globl _remove; _remove:"); /* dept of dirty tricks */
  21. #endif
  22. int
  23. unlink(filename)
  24.     const char * filename;
  25. {
  26.     char name[PATH_MAX];
  27.     int r;
  28.  
  29.     _unx2dos(filename, name);
  30.  
  31.     r = (int)Fdelete(name);
  32.  
  33.     if (r < 0) {
  34.         errno = -r;
  35.         return -1;
  36.     }
  37.     return 0;
  38. }
  39.